# coding:utf-8
# 线程分类
#   内核线程：由操作系统内核创建和撤销
#   用户线程：不需要内核支持而在用户程序中实现的线程
import _thread
import time


def print_time(thread_name, delay):
    count = 0
    while count < 5:
        time.sleep(delay)
        count += 1
        print("%s:%s" % (thread_name, time.ctime(time.time())))


# 创建两个线程
try:
    _thread.start_new_thread(print_time("Thread-A", 2))
    _thread.start_new_thread(print_time("Thread-B", 2))
except:
    print("Error:无法启动线程")

while 1:
    pass
